package pcloud.client.remoteservice;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;

import pcloud.client.util.ClientIdentifier;
import pcloud.client.util.GlobalConfig;
import pcloud.client.util.Logger;

public class ServerChangeService
{

	public static Properties getChange()
	{
		FileService remoteFileService = GlobalConfig.getRemoteFileService();
		
		Properties serverTaskProperties = new Properties();
		try {
			String localTaskFilePath = GlobalConfig.getInstance().getLocalTaskFolderPath()+"/"+ClientIdentifier.getID()+".properties";
			String remoteTaskFilePath = GlobalConfig.getInstance().getRemoteTaskfolderPath()+"/"+ClientIdentifier.getID()+".properties";
			remoteFileService.downloadFile(remoteTaskFilePath, localTaskFilePath);
			
			serverTaskProperties.load(new FileReader(new File(localTaskFilePath)));
			
		} catch (IOException e) {
			logger.info(e.getMessage());
		}
		return serverTaskProperties;
	}

}
